package com.java.jwt.servcie;

import com.java.jwt.entity.PayloadDto;
import com.nimbusds.jose.JOSEException;
import com.nimbusds.jose.jwk.RSAKey;

import java.text.ParseException;

/**
 * @author jl
 * Created on 2020/7/15
 */
public interface JwtTokenService {
    PayloadDto getDefaultPayloadDto();

    String generateTokenByHMAC(String payloadStr, String secret) throws JOSEException;

    PayloadDto verifyTokenByHMAC(String token, String secret) throws ParseException, JOSEException;

    RSAKey getDefaultRSAKey();

    String generateTokenByRSA(String payloadStr, RSAKey rsaKey) throws JOSEException;

    PayloadDto verifyTokenByRSA(String token, RSAKey rsaKey) throws ParseException, JOSEException;
}
